<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link href="./css/api.css" rel="stylesheet"/>
  <link href="./css/element.css" rel="stylesheet"/>
  <link href="./css/base.css" rel="stylesheet"/>
  <title>招聘</title>
</head>
<body>
  <div id="vm" v-cloak>
    <div class="x-t1-at">

      <div class="x-tab1-top">
        <div class="x-tab1-userinfo">
          <div class="x-tab1-l">
            <div class="x-t1-head" :style="{'background-image':'url('+ myuserhead +')'}"></div>
            <div class="x-t1-name">{{myusername}}</div>
          </div>
          <div class="x-t1-addr"><span class="x-tab1-aicon"></span>{{myuserarea}}</div>
        </div>
        <div class="x-tab1-card">
          <div class="x-t1c-t" @click="openmanawin('te2','te2.html')"><span class="x-tab1-dya"></span>查看招聘日志</div>
          <div class="x-t1c-box">
            <div class="x-t1c-li">
              <div class="x-t1c-lit">投递简历</div>
              <div class="x-t1c-linum">{{shownum1}}</div>
            </div>
            <div class="x-t1c-li">
              <div class="x-t1c-lit">咨询人数</div>
              <div class="x-t1c-linum">{{shownum2}}</div>
            </div>
            <div class="x-t1c-li">
              <div class="x-t1c-lit">投递比率</div>
              <div class="x-t1c-linum">{{shownum3}}%</div>
            </div>
            <div class="x-t1c-li">
              <div class="x-t1c-lit">面试平均时长</div>
              <div class="x-t1c-linum">{{shownum4}}min</div>
            </div>
          </div>
        </div>
      </div>
      <!--  -->
      <div class="x-icon-cen">
        <div class="x-tab1-i" @click="toface">
          <div class="x-icon-t x-icon-t1"></div>
          <div class="x-icon-td">扫码面试</div>
        </div>
        <div class="x-tab1-i" @click="openmanawin('interviewlist','interviewlist.html')">
          <div class="x-icon-t x-icon-t2"></div>
          <div class="x-icon-td">面试列表</div>
        </div>
        <div class="x-tab1-i" @click="openmanawin('talentmanagementbox','talentmanagementbox.html')">
          <div class="x-icon-t x-icon-t3"></div>
          <div class="x-icon-td">人才管理</div>
        </div>
        <div class="x-tab1-i" @click="openmanawin('recruittask','recruittask.html')">
          <div class="x-icon-t x-icon-t4"></div>
          <div class="x-icon-td">招聘任务</div>
        </div>
      </div>
    </div>
    <!--  -->
    <div class="x-t1-frame">
      <!--  -->
      <div class="x-frame-tbox">
        <div class="x-frame-tname">店面架构<div class="x-frame-line"></div></div>
        <div class="x-frame-select">
          <el-select v-model="changearea" placeholder="选择区域">
            <el-option
              v-for="item in options"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </div>
      </div>
      <!--  -->
      <div class="x-t1f-row" @click="openmanawin('te1','te1.html')">
        <div class="x-t1f-dbox">
          <div class="x-t1f-dn"><span class="x-t1f-ll"></span>大连直营李宛鸿区域</div>
          <div class="x-t1f-dp">区域负责人:潘霞</div>
        </div>
        <div class="x-t1f-des">
          <div class="x-t1f-cm">在职人数<span class="x-t1f-desnum">20</span></div>
          <div class="x-t1f-cm">试用期人数<span class="x-t1f-desnum">1</span></div>
          <div class="x-t1f-cm" style="text-align:right">人效饱和度<span class="x-t1f-desnum">78%</span></div>
        </div>
      </div>
      <div class="x-t1f-row" @click="openmanawin('te1','te1.html')">
        <div class="x-t1f-dbox">
          <div class="x-t1f-dn"><span class="x-t1f-ll"></span>和平广场店</div>
          <div class="x-t1f-dp">区域负责人:张伟</div>
        </div>
        <div class="x-t1f-des">
          <div class="x-t1f-cm">在职人数<span class="x-t1f-desnum">21</span></div>
          <div class="x-t1f-cm">试用期人数<span class="x-t1f-desnum">4</span></div>
          <div class="x-t1f-cm" style="text-align:right">人效饱和度<span class="x-t1f-desnum">89%</span></div>
        </div>
      </div>
      <div class="x-t1f-row" @click="openmanawin('te1','te1.html')">
        <div class="x-t1f-dbox">
          <div class="x-t1f-dn"><span class="x-t1f-ll"></span>星海广场店</div>
          <div class="x-t1f-dp">区域负责人:高峰</div>
        </div>
        <div class="x-t1f-des">
          <div class="x-t1f-cm">在职人数<span class="x-t1f-desnum">22</span></div>
          <div class="x-t1f-cm">试用期人数<span class="x-t1f-desnum">2</span></div>
          <div class="x-t1f-cm" style="text-align:right">人效饱和度<span class="x-t1f-desnum">90%</span></div>
        </div>
      </div>
    </div>
  </div>
  <script type="text/javascript" src="./script/vue.js"></script>
  <script type="text/javascript" src="./script/element.js"></script>
  <script type="text/javascript" src="./script/api.js"></script>
  <script type="text/javascript" src="./js/base.js"></script>
  <script>
  apiready = function () {
    api.addEventListener({
        name: 'overfaceok'
    }, function(ret, err) {
        vm.getindex()
        openmanawin('interviewlist','interviewlist.html')
    });
    api.addEventListener({
        name: 'loginsucc'
    }, function(ret, err) {
        console.log('登录成功监听');
        vm.getindex()
        vm.myusername = $api.getStorage('username')
        vm.myuserhead = $api.getStorage('userhead')
        vm.myuserarea = $api.getStorage('userarea')
    });
    api.setRefreshHeaderInfo({
      loadingImg: 'widget://image/refresh.png',
      bgColor: '#ccc',
      textColor: '#fff',
      textDown: '下拉刷新...',
      textUp: '松开刷新...'
  }, function(ret, err) {
      vm.getindex()
      setTimeout('api.refreshHeaderLoadDone()', '1000');
  });
      //
    var vm = new Vue({
      el:'#vm',
      data(){
        return{
          myusername:'',
          myuserhead:'',
          myuserarea:'',
          options:[{
            value:'1',
            label:'大连直营李宛鸿区域'
          }
          ],
          changearea:'',
          shownum1:'',
          shownum2:'',
          shownum3:'',
          shownum4:''
        }
      },
      created:function() {
        var that=this;

      },
      mounted:function(){
        var that=this;
        that.getindex()
      },
      methods: {
        getindex:function(){
          var that=this;
          api.ajax({
            url:manaindex+'panel',
            methods:'get',
            data:{
              values:{
                sec:$api.getStorage('usertoken')
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                that.shownum1 = ret.data.total.resume_num;
                that.shownum2 = ret.data.total.audition_num;
                that.shownum3 = ret.data.total.audition_rate;
                that.shownum4 = ret.data.total.audition_time;

                that.isfaceing = ret.data.is_audition;

              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
        toface:function(){
          var that = this;
          console.log(that.isfaceing);
          if(that.isfaceing==0 || that.isfaceing=='0'){
            api.openWin({
              name: 'begincode',
              url: 'begincode.html',
              pageParam: {
                  name: 'test'
              }
            });
          }else{
            api.openWin({
              name: 'soundrecord',
              url: 'soundrecord.html',
              pageParam: {
                  name: 'test'
              }
            });
          }
        },
      }
    })
      console.log($api.getStorage('username'));
      console.log($api.getStorage('userhead'));
      console.log($api.getStorage('userarea'));
      console.log($api.getStorage('usertoken'));
      vm.myusername = $api.getStorage('username')
      vm.myuserhead = $api.getStorage('userhead')
      vm.myuserarea = $api.getStorage('userarea')

      // api.addEventListener({
      //     name: 'loginsucc'
      // }, function(ret, err) {
      //   // console.log($api.getStorage('username'));
      //   // console.log($api.getStorage('userhead'));
      //   // console.log($api.getStorage('usertoken'));
      //   vm.myusername = $api.getStorage('username')
      //   vm.myuserhead = $api.getStorage('userhead')
      //   vm.myuserarea = $api.getStorage('userarea')
      // });
  }
  </script>
</body>
</html>
